home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr28 / blts992.zip / SHARE.TXT < prev    next >
Text File  |  1993-03-01  |  5KB  |  103 lines

  1. The SHARE Command Explained
  2.  
  3.                           What is SHARE?
  4.  
  5. The SHARE.EXE program is included with DOS versions 3.0 and
  6. higher. Although most DOS manuals don't give it much coverage,
  7. understanding SHARE can be vital to the success of your network,
  8. especially if you are running a multi-user database, or a similar
  9. application that works with several files at a time.
  10.  
  11. SHARE gives applications an easy, well-defined way to keep users
  12. from accessing the same files, or the same regions of files
  13. simultaneously. Once SHARE has been run, an application can use it
  14. to "lock" a files or region so that only one person at a time can
  15. make changes. Most multi-user and network software packages use
  16. SHARE to implement their file and record locking. This bulletin
  17. will discuss how SHARE works and how it can affect your LANtastic
  18. network.
  19.  
  20.                          How SHARE Works
  21.  
  22. SHARE maintains two tables in memory. The first table, the FILES
  23. table, contains the complete pathname of each file that has been
  24. opened, plus an internal file handle number and other housekeeping
  25. information.  The second table, the LOCK table, contains a list of
  26. internal file handle numbers and corresponding information on the
  27. various areas of each file that are locked. SHARE checks these
  28. tables whenever an application asks to open or use a file or a
  29. region of a file, and lets the application know whether or not the
  30. file or region is available.
  31.  
  32. SHARE uses at least one entry in each table for each file that is
  33. opened. The more files your computer opens and locks, the more
  34. space SHARE needs for its internal tables.  You can control the
  35. size of SHARE's internal tables with two command line options, /F
  36. and /L. The /F option controls the amount of space allocated for
  37. the FILES table and the /L option controls the number of
  38. simultaneous locks that SHARE will allow.  To help you figure out
  39. exactly how much space you'll need, let's examine each parameter
  40. in detail.
  41.  
  42. The /F Parameter
  43.  
  44. The /F parameter controls the size (in bytes) of the table that
  45. SHARE reserves for file names and file handles. The syntax for
  46. using the /F parameter is
  47.  
  48. SHARE /F:n
  49.  
  50. where n is any number from 0 to approximately 62,000 (by empirical
  51. test). The default is /F:2048. SHARE stores the complete pathname
  52. of each file, plus 11 bytes of file handle and housekeeping
  53. information.  You can find the worst case space requirement by
  54. multiplying the number of files in your CONFIG.SYS by 71 (60 bytes
  55. for the worst case pathname + 11 bytes for other information).
  56. For a system with FILES = 255 in its CONFIG.SYS, that means that
  57. in the worst case, with all 255 files open, SHARE will require
  58. over 18,100 bytes for the FILES table.
  59.  
  60. On a network server, you will need to allocate enough space for
  61. all the files that will be opened by all the users on the network.
  62. The default value is 2048 bytes -- enough to hold the information
  63. for 66 files with paths averaging 20 characters, or about 28 files
  64. in a worst case scenario.  If you know that paths on your machine
  65. average more than 20 characters, or that you will be opening lots
  66. of files, you should probably use the /F parameter to give SHARE
  67. more space for its FILES table. 
  68.  
  69.  
  70. The /L Parameter
  71.  
  72. The /L parameter controls the number of simultaneous locks that
  73. SHARE can handle. It's probably the biggest potential troublemaker
  74. for network users. The syntax for the /L parameter is
  75.  
  76. SHARE /L:n
  77.  
  78. where n is any integer between 1 and approximately 3800 (again, by
  79. empirical test). The default is /L:20 -- that is, 20 locks. On a
  80. network like LANtastic, which can open 5100 files per server, it's
  81. easy to see that 20 locks just isn't enough.
  82.  
  83. Opening a file on a server requires at least one lock. In
  84. addition, most network programs use several more locks per file.
  85. They lock individual records, and even individual fields within
  86. records.  Multi-user databases especially can use lots of locks,
  87. sometimes 10 or more per file.  On a network, with several users
  88. opening each file, SHARE's default 20 locks can be used up almost
  89. instantly. 
  90.  
  91. To add to the confusion, application programs behave in a somewhat
  92. unpredictable manner when SHARE runs out of locks. Some programs
  93. correctly report the error, some simply report "Access Denied" or
  94. "Sharing Violation", and some just lock up the computer.  The
  95. bottom line is that on your servers, you should use the /L
  96. parameter to increase the number of locks allowed.  The /L setting
  97. should be at least the number of files you've specified in your
  98. CONFIG.SYS or in the NET_MGR Server Startup Parameters option
  99. (whichever is larger). If you're running a multi-user program that
  100. uses lots of files, you should consider setting /L to at least
  101. twice the number of open files allowed. 
  102.  
  103.